<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of EventsController
 *
 * @author NguyenVanTien
 */
class EventsController extends Zend_Controller_Action{
    
    public function listEventCategoriesAction(){
        $serviceEvent = new Webservices_Events();
        Zend_Debug::dump($serviceEvent->listEventCategories("admin", "123"));
        $this->_helper->viewRenderer->setNoRender();
    }

    public function getCategoryByIdAction(){
         $wServiceEvent = new Webservices_Events();
        Zend_Debug::dump($wServiceEvent->getCategoryById("admin", "123", 1));
        die;        
    }
    
    public function editAction(){
        $u = $this->_getParam('u');
        $p = $this->_getParam('p');
        $data = '{"createdDate":"0000-00-00 00:00:00","lng":"12.78798","eventDescriptions":"Mo ta","eventDetail":"I change value of this field","lat":"10.32432","eventName":"Thanh pho viet nam","eventId":6,"eventCategoryId":0,"visible":false}';
        
        $wServiceEvent = new Webservices_Events();
        Zend_Debug::dump($wServiceEvent->editEvent($u, $p, $data));
        die;        
    }
    
      public function getAction(){
        $u = $this->_getParam('u');
        $p = $this->_getParam('p');
        $id = $this->_getParam('id');
        
        $wServiceEvent = new Webservices_Events();
        Zend_Debug::dump($wServiceEvent->getEvent($u, $p, $id));
        die;        
    }
    
    public function addEventAction(){
        $u = $this->_getParam('u');
        $p = $this->_getParam('p');
        //data
        $data = '{"createDate":"Dec 10, 2011 3:19:38 PM","lng":"12.78798","eventDescriptions":"Mo ta","eventDetail":"Chi tiet ","lat":"10.32432","eventName":"Thanh pho viet nam","eventId":0,"eventCategoryId":0,"visible":true}';
        
        $wServiceEvent = new Webservices_Events();
        Zend_Debug::dump($wServiceEvent->addEvent($u, $p, $data));
        die;        
    }
    
    /**
     * Action list event 
     * @author Tien Nguyen
     */
    public function listEventsAction(){
        $username = $this->_getParam('username');
        $password = $this->_getParam('password');
        $lat = $this->_getParam('lat');
        $lng = $this->_getParam('lng');
        
        $serviceEvent = new Webservices_Events();
        echo $serviceEvent->listEvents($username, $password, $lat, $lng);
        $this->_helper->viewRenderer->setNoRender();
        die;
    }
}

?>
